<?php
namespace app\admin\validate;
use think\Validate;

/**
 * Created by PhpStorm.
 * User: HuangLuSen
 * Date: 2017/5/4
 * Time: 19:36
 */
class Users extends Validate
{
    protected $rule = [
        'username'     =>  'require|unique:Users|token',
        'phone'       =>  'require|unique:Users',
        'depar_id'  =>  'require',
    ];
    protected $message =[
        'username.require'=>'用户名称不能为空',
        'phone.require'=>'电话号码部能为空',
        'phone.unique'=>'电话重复了',
        'username.unique'=>'用户名不能重复',
        'depar_id.require'=>'部门必选',
    ];
    protected $scene = [
        'edit'  =>  [
//            'username'=>'require|unique:Users,username^id',
            'phone'=>'require|unique:Users,phone^id|token'
        ]
    ];
}